package com.dd.lnetwork.provider

import android.content.Context
import okhttp3.Interceptor
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor

interface IProvider {
    /**
     * 初始化
     *
     * @param context
     */
    fun initClass(
        context: Context, deviceId: String,
        token: String?,
        cookies: HashSet<String>?
    )

    /**
     * 返回对应的api
     *
     * @param service
     * @param okHttpClient
     * @param <T>
     * @return </T>
     */
    fun <T> create(service: Class<T>, okHttpClient: OkHttpClient): T

    /**
     * 返回对应的api
     *
     * @param service
     * @param okHttpClient
     * @param baseUrl
     * @param <T>
     * @return </T>
     */
    fun <T> create(service: Class<T>, okHttpClient: OkHttpClient, baseUrl: String): T

    /**
     * 带log
     *
     * @param level
     * @param interceptors
     * @return ""
     */
    fun getHttpClient(
        level: HttpLoggingInterceptor.Level,
        vararg interceptors: Interceptor?
    ): OkHttpClient

    /**
     * 可设置响应时间
     *
     * @param readTimeOut
     * @param writeTimeOut
     * @param connectTimeOut
     * @param level
     * @param interceptors
     * @return
     */
    fun getHttpClient(
        readTimeOut: Int,
        writeTimeOut: Int,
        connectTimeOut: Int,
        level: HttpLoggingInterceptor.Level,
        vararg interceptors: Interceptor?
    ): OkHttpClient?
}